<!DOCTYPE html>
<html>
<head>
    <title>${sysEn}-配件保养类别列表</title>
     <#include "/common/com_css.ftl" >
</head>
<body>
    <div id="wrapper">
        <!----左侧导航开始----->
        <#include "/common/menu.ftl">
        <!----左侧导航结束----->

        <!---右侧内容区开始---->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <#include "/common/con_nav.ftl">
            <@con_nav_tag current="用户管理"></@con_nav_tag>
            <!-- 检索条件开始 -->
            <div class="ibox-content m-b-sm border-bottom">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group">
                            <label class="col-form-label" for="status">用户名称</label>
                            <input type="text" id="userName" class="form-control m-b" placeholder="用户名称">
                        </div>
                    </div>
                </div>
                <div class="text-left">
                    <input type="button" name="" class="btn btn-primary" value="提交" id="btnSubmit"></input>
                </div>
            </div>
            <!-- 检索条件结束 -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox ">
                        <div class="ibox-content">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover" id="example" >
                                </table>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
            <#include "/common/footer.ftl">
        </div>
        <!---右侧内容区结束---->
     </div>
    <#include "/common/com_table_js.ftl">
    <script>
        $(document).ready(function() {
            var table =  ListPageManager.DataTable.init({
                ajax:{
                    url:"${ctx}/cms_user_list_data.do"
                },
                ajaxParam:function(){
                    var obj = {};
                    if($("#userName").val()) {
                        obj["userName"] = $("#userName").val();
                    }
                    return obj;
                },
                buttons:[{cmd:'add'}],
                addUrl:function(){return "${ctx}/cms_user_edit.do"},
                updUrl:function(row,data,dataIndex){return "${ctx}/cms_user_edit.do?id=" + data.id; },
                deleteUrl:function(row,data,dataIndex){return "${ctx}/cms_user_del.do?id=" + data.id},
                rowCreatedCall:function(row,data,dataIndex){},
                columns:[
                    {title:"序号",data:"id"},
                    {title:"用户名称",data:"userName"},
                    {title:"所属角色",data:"roleName"},
                    {title:"状态",render:function (ctx,status,data) {
                        if(data.status == 1){
                            return "启用";
                        }else{
                            return "停用";
                        }
                        }},
                    {title:"登陆次数",data:"loginCount"},
                    {title:"最后登陆时间",render:function (data,type,row) {
                            return ListPageManager.Tools.formatDate(row["dtmLastLogin"]);
                        }},
                    {title:"创建人",data:"createByName"},
                    {title:"修改时间",render:function (data,type,row) {
                            return ListPageManager.Tools.formatDate(row["updateTime"]);
                    }},
                    {title:"",toolcolinfo:[{"cmd":"status",gettext:function(data,type,row){
                               if(row.status == 1){
                                   return "停用";
                               }else{
                                   return "启用";
                               }
                            },click:function(cmd,row,data,dataIndex){
                                if(data.type)
                                ListPageManager.Popup.popFullPage("${ctx}/cms_user_edit.do?id=" + data.id ,"编辑信息",function(){
                                    table.redraw();
                                });
                            }},{cmd:"upd"},{"cmd":"del"}]}
                ]
            },$("#example"));
            $("#btnSubmit").on("click",function(){
                table.redraw();
            });
        });
    </script>
</body>
</html>
